//
//  StockTableQuoteCell.h
//  iStock Global
//
//  Created by Andy on 2010/10/2.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "DownloadData.h"
#import "CorePlot-CocoaTouch.h"
#import "RegexKitLite.h"


@interface StockTableQuoteCell : UITableViewCell<DownloadDataDelgete, CPTPlotDataSource,CPTPlotSpaceDelegate, CPTBarPlotDelegate  > {
	   
    
    //UILabel *code;
	//UILabel *name;
	UILabel *lasdprice;
	UILabel *tradetime;
	UILabel *tradeDate;
	UIView  *UpDownView;
	UILabel *updown;
	UILabel *updownpercent;	
	UILabel *updownsigne;	
	
	
	UILabel *c0r0; // 第1行
	UILabel *c0r1;  	
	UILabel *c0r2;  
	UILabel *c1r0; //  第2行
	UILabel *c1r1;  	
	UILabel *c1r2;  	
	UILabel *c2r0; //  第3行
	UILabel *c2r1;  	
	UILabel *c2r2;  
	
    //標記:表格內展開出現日內走勢圖 宣告
    UILabel *zoom;    
    CPTXYGraph * graph;	
	CPTGraphHostingView *Chartview;	
    
    CPTXYGraph * graph_volume;	
	CPTGraphHostingView *Chartview_volume;
    
    CPTXYGraph * graph_range;	
	CPTGraphHostingView *Chartview_range;    
    
    //plotSpace 繪圖空間
    CPTXYPlotSpace *plotSpace1 ;
    CPTXYPlotSpace *plotSpace_volume ;
    CPTXYPlotSpace *plotSpace_range ;      
    
    //標籤   
    CPTTextLayer *graph_label_top;    
    
    CPTScatterPlot *dataSourceLinePlot1;
    //CPScatterPlot *dataSourceLinePlot_preClose;  
    
    CPTBarPlot *dataSourceLinePlot_volume_up; 
    CPTBarPlot *dataSourceLinePlot_volume_down;    
    
    CPTScatterPlot *dataSourceLinePlot_range;  
    CPTScatterPlot *dataSourceLinePlot_range_selected;     
   // CPScatterPlot *dataSourceLinePlot_range_preClose;      
    CPTBarPlot *dataSourceLinePlot_range_volume; //注意此柱狀圖是採用比例方式 放在 plotSpace_range上
    
    int index_intraday;
    
    NSMutableArray *graph_data_aray; //記錄有交易時間內的股價與時間資料
    NSMutableArray *graph_data_x_time; //記錄有交易時間與尚未交易內的時間資料
    NSMutableArray *graph_data_aray_raw;
    NSMutableArray *graph_data_aray_real;
   
    NSString *select_right;
    NSString *select_left;
    
    //標記:日內走勢圖記憶體宣告實體與消滅 宣告    
    NSMutableArray *cell_intraday_data_code; //暫存日內資料
    NSMutableArray *cell_intraday_data; //暫存日內資料
 	NSMutableArray *cell_intraday_data_x_time; //暫存日內資料     
    NSMutableArray *cell_intraday_graph_x_length;// 日內走勢圖的x軸 長度
    NSMutableArray *cell_intraday_graph_x_high;// 日內走勢圖的x軸 長度    
    NSMutableArray *cell_intraday_graph_x_low;// 日內走勢圖的x軸 長度
    
    NSMutableArray *cell_intraday_graph_lastdayClose;// 日內走勢圖的x軸 長度
    NSMutableArray *cell_intraday_graph_volume_high;// 日內走勢圖的x軸 長度    
    NSMutableArray *cell_intraday_graph_volume_low;// 日內走勢圖的x軸 長度    
    
    NSMutableArray *cell_intraday_graph_selected_right;//日內走勢圖的x軸 右邊    
    NSMutableArray *cell_intraday_graph_selected_left; //日內走勢圖的x軸 左邊     
    
    //網路資料下載物件
	DownloadData *downloadobject; 
    UIActivityIndicatorView *ActivityIndicator;	
    
    //價格走勢圖上高低 
    float high_graph_selected,low_graph_selected; //此數据主要是用在graph圖上 y軸的高低範圍
    float high_graph_all,low_graph_all;  //此數据主要是用在volume圖上 y軸的高低範圍
    //成交量高低
    float high_volume_selected,low_volume_selected;  
    float high_volume_all,low_volume_all;  
     
    //X軸的最左與最右
    int right_selected,left_selected;//區間範圍    
    int right_all,left_all;//全部     
    int right_all_x_time,left_all_x_time;//全部    
    
    int min_range;  //區間範圍選定的最小區間距離 
    
    float lastday_close;//前日收盤價
    
    int move_center,move_length;//移動中心點 與選定移動時的距離
}
@property(nonatomic,assign) UILabel *c0r0;
@property(nonatomic,assign) UILabel *c0r1;
@property(nonatomic,assign) UILabel *c0r2;
@property(nonatomic,assign) UILabel *c1r0;
@property(nonatomic,assign) UILabel *c1r1;
@property(nonatomic,assign) UILabel *c1r2;
@property(nonatomic,assign) UILabel *c2r0;
@property(nonatomic,assign) UILabel *c2r1;
@property(nonatomic,assign) UILabel *c2r2;
@property(nonatomic,assign) UILabel *zoom;

//@property(nonatomic,readonly) UILabel *code;
//@property(nonatomic,readonly) UILabel *name;
@property(nonatomic,readonly) UILabel *lastprice;
@property(nonatomic,readonly) UILabel *tradetime;
@property(nonatomic,readonly) UILabel *tradeDate;
@property(nonatomic,readonly) UIView *UpDownView;
@property(nonatomic,readonly) UILabel *updown;
@property(nonatomic,readonly) UILabel *updownsigne;
@property(nonatomic,readonly) UILabel *updownpercent; 

-(void)hiden_secondTable;
-(void)drawGraph:(NSString *) symbol;

-(void)get_preday_close:(float)preday_close;

//標記:日內走勢圖記憶體宣告實體與消滅 方法宣告
-(void)get_cell_intraday_data:(NSMutableArray *) p_intraday_data 
           intraday_data_code:(NSMutableArray *) p_intraday_data_code 
         intraday_data_x_time:(NSMutableArray *) p_intraday_data_x_time
      intraday_graph_x_length:(NSMutableArray *) p_intraday_graph_x_length   
        intraday_graph_x_high:(NSMutableArray *) p_intraday_graph_x_high  
         intraday_graph_x_low:(NSMutableArray *) p_intraday_graph_x_low   
  intraday_graph_lastdayClose:(NSMutableArray *) p_intraday_graph_lastdayClose   
   intraday_graph_volume_high:(NSMutableArray *) p_intraday_graph_volume_high  
    intraday_graph_volume_low:(NSMutableArray *) p_intraday_graph_volume_low 
intraday_graph_selected_right:(NSMutableArray *) p_intraday_graph_selected_right  
 intraday_graph_selected_left:(NSMutableArray *) p_intraday_graph_selected_left ;

-(void)BeginDrawGraph:(NSString*)symbol
           data_array:(NSMutableArray *)p_graph_data_array 
    data_array_x_time:(NSMutableArray *)p_graph_data_array_x_time 
        lengthofgraph:(int)a_lengthgraph 
               i_high:(float)a_high
                i_low:(float)a_low
          volume_high:(float)a_volume_high
           volume_low:(float)a_volume_low;


-(void)plotSpace1_plotSpace_volume_clickandmove:(NSString *)ClickOrMove plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(id)event atPoint:(CGPoint)point;

-(void)clickandmove:(NSString *)ClickOrMove plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(id)event atPoint:(CGPoint)point;

-(NSString *)Symbol_converTo_timeZoneWithName:(NSString*) symbol;
@end
